<?php
/**
 * Routes configuration
 *
 * In this file, you set up routes to your controllers and their actions.
 * Routes are very important mechanism that allows you to freely connect
 * different URLs to chosen controllers and their actions (functions).
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
	Router::connect('/', array('controller' => 'jobs', 'action' => 'promoted'));
	

/**
 * ...and connect the rest of 'Pages' controller's URLs.
 */
	Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
	Router::connect('/admin', array('controller' => 'users', 'action' => 'dashboard', 'admin' => true));
	/*** ...Lop hoc.*/
	
	Router::connect('/'.__d('front','lop').'/'.__d('front','xem-lop').'-:slug-:id', array('customer'=>false,'controller'=>'jobs','action'=>'view'),array('pass'=>array('slug','id')));
    Router::connect('/'.__d('front','lop'), array('customer'=>false,'controller'=>'jobs','action'=>'index'));
    
    	/*** ...Tin tuc.*/
    Router::connect('/'.__d('front','tin-tuc'), array('customer'=>false,'plugin'=>'blog','controller'=>'blog_posts','action'=>'index')); 
    Router::connect('/'.__d('front','tin-tuc').'/'.__d('front','xem-tin').'-:slug-:id', array('customer'=>false,'plugin'=>'blog','controller'=>'blog_posts','action'=>'view'),array('pass'=>array('slug','id'))); 
    Router::connect('/'.__d('front','gioi-thieu').'-:id', array('customer'=>false,'plugin'=>'blog','controller'=>'blog_posts','action'=>'view'),array('pass'=>array('id')));
    Router::connect('/'.__d('front','hoc-phi-tham-khao').'-:id', array('customer'=>true,'plugin'=>'blog','controller'=>'blog_posts','action'=>'view'),array('pass'=>array('id')));  
    /*** ...Tim kiem.*/
   	Router::connect('/'.__d('front','lop').'/'.__d('front','tim-kiem'), array('customer'=>false,'controller'=>'jobs','action'=>'search'));

      /*** ...Phu huynh.*/
   Router::connect('/'.__d('front','phu-huynh'), array('customer'=>true,'controller'=>'customers','action'=>'index'));
   Router::connect('/'.__d('front','phu-huynh').'/'.__d('front','dang-ky-hoc'), array('customer'=>true,'plugin'=>'','controller'=>'jobs','action'=>'add'));
   Router::connect('/'.__d('front','phu-huynh').'/'.__d('front','dang-ky-thanh-vien'), array('customer'=>true,'plugin'=>'','controller'=>'customers','action'=>'add'));
   Router::connect('/'.__d('front','phu-huynh').'/'.__d('front','gia-su-hien-co'), array('customer'=>true,'plugin'=>'','controller'=>'tutors','action'=>'index'));
    /*** ...gia su.*/
  Router::connect('/'.__d('front','dang-ky-gia-su'), array('customer'=>false,'plugin'=>'','controller'=>'users','action'=>'add'));
  Router::connect('/'.__d('front','ho-so-gia-su'), array('customer'=>false,'plugin'=>'','controller'=>'tutors','action'=>'profile'));
  Router::connect('/'.__d('front','ho-so-gia-su').'/'.__d('front','chinh-sua-thong-tin'), array('customer'=>false,'plugin'=>'','controller'=>'tutors','action'=>'edit'));
   /*** ...Thu vien.*/
   Router::connect('/'.__d('front','thu-vien'), array('customer'=>false,'plugin'=>'documents','controller'=>'categories','action'=>'view_home'));
   Router::connect('/'.__d('front','thu-vien').'/:slug', array('customer'=>false,'plugin'=>'documents','controller'=>'categories','action'=>'view'),array ('pass'=>array('slug')));
  
   Router::connect('/social_login/*', array( 'controller' => 'users', 'action' => 'social_login'));
   Router::connect('/social_endpoint/*', array( 'controller' => 'users', 'action' => 'social_endpoint'));
   Router::connect('/tin-tuc/:category/*',array('plugin' => 'blog',
    'controller' => 'blog_posts',
    'action' => 'index'
  ),
  array(
    'pass' => array('category'),
    'category' => '[a-zA-Z0-9\-\_]+',
  )
);
/**
 * Load all plugin routes. See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
 */
	CakePlugin::routes();
  Router::parseExtensions('json', 'rss');

/**
 * Load the CakePHP default routes. Only remove this if you do not want to use
 * the built-in default routes.
 */
	require CAKE . 'Config' . DS . 'routes.php';
